namespace ContactApp.Db.Migrations
{
    using ContactApp.DataModels;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<ContactApp.Db.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(ContactApp.Db.ApplicationDbContext context)
        {
            context.Contacts.AddOrUpdate(
                c => c.PhoneNumber,
                new Contact() { FirstName = "Bill", LastName = "Lilly", Title = "Constructor", PhoneNumber = "222-444-5555" },
                new Contact() { FirstName = "Sill", LastName = "Lilly", Title = "Producer", PhoneNumber = "222-441-5555" },
                new Contact() { FirstName = "Cill", LastName = "Billy", Title = "Clown", PhoneNumber = "222-442-5555" },
                new Contact() { FirstName = "Pill", LastName = "Tilly", Title = "Manager", PhoneNumber = "222-443-5555" }
                );
            context.SaveChanges();
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }
    }
}
